home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 34 / 034.d81 / printer maze (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  3KB  |  115 lines

  1. 5 dim p$(78,3),d$(3),r(5),ck$(50)
  2. 10 poke53280,.:poke53281,.:print"[147]"chr$(142)"              printer maze"
  3. 12 print"         [153]by jerry a. sturdivant"
  4. 20 rem   initialise
  5. 30 rem" [184][184][184][184][184][184][184][184][184][184][184][184]"
  6. 50 choice$(0)="pattern ":choice$(1)="mix ":r=rnd(-ti):n=1
  7. 60 d$(1)="[186][164][204][186] [204] [205][205][206][206] "
  8. 70 d$(2)="   [167] [165][205][160][205][206][160][206]"
  9. 80 d$(3)="[208][163][207][208][160][207][205][205][160][160][206][206]"
  10. 90 rem    inputs
  11. 100 rem" [184][184][184][184][184][184][184][184]"
  12. 110 mix=0:ran=0:screen=0:nu=0:a=0
  13. 120 print"[154](s[154])creen, (h[154])ard copy, or (q[154])uit       "
  14. 130 get a$:if(asc(a$+chr$(.))>128)thena$=chr$(asc(a$)-128)
  15. 135 if(a$<>"s")and(a$<>"h")and(a$<>"q")then130
  16. 137 ifa$="q"thengosub6000:goto120
  17. 138 if a$="h" thengosub7000:if(ab)thenab=.:goto120
  18. 140 if a$="s" then screen=1
  19. 150 print"(p[154])attern or (m[154])ix or (r[154])andom"
  20. 160 get a$:if(asc(a$+chr$(.))>128)thena$=chr$(asc(a$)-128)
  21. 165 if a$<>"p"anda$<>"m"anda$<>"r"then160
  22. 170 if a$="m" then mix=1
  23. 180 if a$="r" then ran=1:goto 240
  24. 190 print"would you like to enter a pattern"
  25. 195 print"number (y[154]/n[154])"
  26. 200 get a$:if a$<>"y"anda$<>"n"anda$<>"[217]"anda$<>"[206]"then200
  27. 210 if a$="y" ora$="[217]" then gosub 870:rem get selected number
  28. 215 print"[147]";
  29. 220 rem   set output
  30. 230 rem" [184][184][184][184][184][184][184][184][184][184][184][184]"
  31. 240 across=78:vertical=(66-2)*2:device=4:a=0
  32. 250 if screen then across=39:vertical=23:device=3
  33. 260 close 1:open 1,device
  34. 270 if device=4 then close 6:open 6,4,6:print#6,chr$(18)
  35. 280 ifnu=1then510
  36. 290 if(a$="h")then 540
  37. 300 a$=""
  38. 310 rem   pick 4 rnd numbers
  39. 320 rem" [184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184]"
  40. 330 for i=1 to 4
  41. 340 r(i)=int(rnd(0)*4)
  42. 350 ho$(i)=str$(r(i))
  43. 360 next
  44. 370 if r(1)=r(2) and r(2)=r(3) and r(3)=r(4) then 330
  45. 380 n=n+1:if n=50 then 830:rem quit
  46. 390 rem   memorize the numbers
  47. 400 rem" [184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184]"
  48. 410 ck$(n)="":for i=1 to 4
  49. 420 ck$(n)=ck$(n)+right$(ho$(i),1)
  50. 430 next
  51. 440 rem   see if used before
  52. 450 rem" [184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184]"
  53. 460 compare=n
  54. 470 for i=1 to n-1
  55. 480 if ck$(i)=ck$(compare) then 330
  56. 490 next
  57. 510 print"[147][129]selection number: [158]" choice$(mix) ck$(n)"[159]";
  58. 520 rem   set up three lines
  59. 530 rem" [184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184]"
  60. 540 for row=1 to vertical/3
  61. 550 if mix then r(5)=r(4):r(4)=r(3):r(3)=r(2):r(2)=r(1):r(1)=r(5)
  62. 560 for x=1 to across/3
  63. 570 a=a+1:if a>4 then a=1
  64. 580 r=r(a)*3+1
  65. 590 if ran then r=int(rnd(0)*4)*3+1
  66. 600 for y=1 to 3
  67. 610 p$(x,y)=mid$(d$(y),r,3)
  68. 620 next y,x
  69. 630 rem   print those three lines
  70. 640 rem" [184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184]"
  71. 650 for y=1 to 3
  72. 660 print#1
  73. 670 for x=1 to across/3
  74. 680 print#1,p$(x,y);
  75. 690 next x
  76. 700 get a$:if a$=" " then 730
  77. 710 next y
  78. 720 next row
  79. 730 if screen=0 then for i=1 to 6:print#1:next
  80. 740 rem   full page-now what?
  81. 750 rem" [184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184]"
  82. 760 print
  83. 770 print"  [154]would you like to do another? (y[154]/n[154])"
  84. 800 get a$:ifa$<>"y"anda$<>"n"anda$<>"[217]"anda$<>"[206]"then800
  85. 820 if a$="y"ora$="[217]"then10
  86. 830 close 1:if device=4 then print#6,chr$(36):close 6
  87. 840 open15,8,15,"r0:hello connect=hello connect":input#15,er:close15
  88. 842 print"[147]";:ifer<>63thenend
  89. 844 load"hello connect",8
  90. 850 rem   input selected number
  91. 860 rem" [184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184]"
  92. 870 n=n+1:nu=1
  93. 880 print "[154]enter a four-digit number  [0 - 3]"
  94. 885 print ":[164]    [157][157][157][157]";:gosub5000:ck$(n)=a$
  95. 886 ok=-1:fora=1tolen(a$):ifmid$(a$,a,1)>"3"ormid$(a$,a,1)<"0"thenok=.
  96. 887 next:ifnot(ok)thenprint"[145][145][145]";:goto880
  97. 890 for i= 1 to 4
  98. 900 r(i)=val(mid$(ck$(n),i,1))
  99. 910 next
  100. 920 return
  101. 5000 fora=1to4:g$(a)=""
  102. 5010 geta$:ifa$=""then5010
  103. 5020 if(a$=chr$(20))and(a>1)thena=a-1:print"[157][157]  [157][157][164]";:g$(a)="":goto5010
  104. 5040 if(a$<"0")or(a$>"9")then5010
  105. 5050 print"[157]"a$"[164]";:g$(a)=a$:next
  106. 5060 print"[157] ":a$=""
  107. 5070 forb=1toa-1:a$=a$+g$(b):next:return
  108. 6000 print"[145]  are you sure you want to quit? (y[154]/n[154])"
  109. 6010 geta$:ifa$<>"y"anda$<>"[217]"anda$<>"n"anda$<>"[206]"then6010
  110. 6020 ifa$="n"ora$="[206]"thenprint"[145]";:return
  111. 6030 goto840
  112. 7000 open15,4,15:close15:if(st=.)thenreturn
  113. 7010 print"[145][150]can't use printer ... it's not on-line.[145]"
  114. 7020 fora=1to2000:next:ab=-1:return
  115.